package com.cq.school.web;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created with IntelliJ IDEA.
 * User: huke
 * Date: 14-3-17
 * Time: 下午10:35
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping(value = "/man/login")
public class LoginAction {
    @RequestMapping(method = RequestMethod.GET)
    	public String login() {
    		return "manage/login";
    	}

    	@RequestMapping(method = RequestMethod.POST)
    	public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName, Model model) {
    		model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
    		return "manage/login";
    	}

}
